home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
mg2a_src.zip
/
SYS
/
VMS
/
TRNLNM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-08-23
|
2KB
|
76 lines
/*
* Name: MicroEmacs
* VAX/VMS translate logical name routine
* Version: Gnu30
* Last Edit: 10-Jul-86
* By: ...!ihnp4!seismo!ut-sally!ut-ngp!mic
*
*/
/*
*
* Trnlnm()
*
* Description:
* Attempt to translate the logical name logname into an equivalence
* string, using the standard VMS routine LIB$SYS_TRNLOG().
* If a translation exists, return a pointer to the static area
* that contains the null-terminated translation string. If not,
* return 0.
*
* Bugs:
* Returns a pointer to static data that is modified each time
* the routine successfully translates a logical name.
*/
#include <ssdef.h>
#include <descrip.h>
#include <stdio.h>
static char _equiv_buf[256];
static struct dsc$descriptor_s
_equiv = {
sizeof(_equiv_buf), DSC$K_DTYPE_T, DSC$K_CLASS_S, _equiv_buf
},
_name = {
0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL
};
char *trnlnm(logname)
char *logname;
{
short eqlen;
int status;
if (logname == NULL)
return (NULL);
_name.dsc$a_pointer = logname;
_name.dsc$w_length = strlen(logname);
status = lib$sys_trnlog(&_name, &eqlen, &_equiv);
if (status != SS$_NORMAL)
return (NULL);
_equiv_buf[eqlen] = '\0';
return (_equiv_buf);
}
/* gettermtype -- get the terminal type used for MG.
*
* If there is a logical name translation for EMACS_TERM, return that.
* Otherwise translate the logical name TERM.
* (Both GNU Emacs and Unipress Emacs use EMACS_TERM, but Eunice likes TERM.)
*
*/
char *gettermtype()
{ register char *result;
if (result = trnlnm("EMACS_TERM"))
return(result);
else
return(trnlnm("TERM"));
}